{include file="public/header" /}

<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{:lang('admin')['Index-userlist']}</h5>
                    <div class="ibox-tools">
                        <button type="button" class="btn btn-primary btn-xs"
                                onclick="changeUserType()">{:lang('change user type')}
                        </button>
                    </div>
                </div>

                <div class="ibox-content">

                    <div class="row">
                        <form method="get" action="{:U('Index/userList')}">
                            <div class="col-sm-3 m-b-xs">

                            </div>
                            <div class="col-sm-3 m-b-xs">

                            </div>
                            <div class="col-sm-3 m-b-xs">

                            </div>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" name="keywords"
                                           class="input-sm form-control" value="{$keywords}">
                                    <span class="input-group-btn">
                                    <input type="submit" class="btn btn-sm btn-primary" value=" {:lang('search')}">
                                </span>
                                </div>
                            </div>
                        </form>
                    </div>

                    <div class="hr-line-dashed"></div>

                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>
                                    <input id="checkAll" type="checkbox">
                                </th>
                                <th>{:lang('number')}</th>
                                <th>{:lang('username')}</th>
                                <th>{:lang('user type')}</th>
                                <th>{:lang('user phone')}</th>
                                <th>{:lang('user email')}</th>
                                <th>{:lang('user nickname')}</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="v" key="k"}
                            <tr>
                                <td>
                                    <input id="{$v.id}" type="checkbox" class="inputCheckBox">
                                </td>
                                <td>
                                    {$k}
                                </td>
                                <td>{$v.username}</td>
                                <td>{$v.userTypeName}</td>
                                <td>{$v.phone}</td>
                                <td>{$v.email}</td>
                                <td>{$v.nickname}</td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {$list->render()}
                    </div>

                </div>
            </div>
        </div>

    </div>
</div>

{include file="public/footer" /}
<script>

    function changeUserType() {
        var ids = '';
        //  编辑选中的
        $('input[class="inputCheckBox"]').each(function () {
            if ($(this).is(':checked')) {
                ids += $(this).attr('id') + ','
            }
        });

        layer.open({
            type: 2,
            title: '{:lang("edit")}',
            skin: 'layui-layer-rim', //加上边框
            area: ['40%', '40%'], //宽高
            shadeClose: true, //开启遮罩关闭
            content: '/Admin/Index/editUserType?ids=' + ids
        });
    }

    function editRole(roleID) {
        layer.open({
            type: 2,
            title: '{:lang("edit")}',
            skin: 'layui-layer-rim', //加上边框
            area: ['80%', '80%'], //宽高
            shadeClose: true, //开启遮罩关闭
            content: '/Admin/Admin/editRole?roleID=' + roleID
        });
    }

    function addRole() {
        layer.open({
            type: 2,
            title: '{:lang("add")}',
            skin: 'layui-layer-rim', //加上边框
            area: ['80%', '80%'], //宽高
            shadeClose: true, //开启遮罩关闭
            content: '/Admin/Admin/addRole'
        });
    }
</script>